package com.yanqu.road.server.cmd.activity.witchdraw;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.WitchDrawProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.witchdraw.CrossWitchDrawMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;


@Cmd(code = CrossProtocol.C_CROSS_WITCH_DRAW_UPLOAD_NOTICE, desc = "跨服上传魔女之夜抽奖公告")
public class CrossWitchDrawUploadNoticeCmd extends CrossCommand {

    private int activityId;

    private List<WitchDrawProto.WitchDrawNoticeData> noticeData;

    private long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WitchDrawProto.UpdateNoticeDataToCrossReq reqMsg = WitchDrawProto.UpdateNoticeDataToCrossReq.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        noticeData = reqMsg.getNoticeDataList();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossWitchDrawMgr.addDrawNotice(activityId, noticeData, userId);
    }

    @Override
    public void sendData() {

    }
}
